package cn.com.nou.base.controller;

import cn.com.nou.base.R;
import cn.com.nou.base.service.SpecInfoService;
import cn.com.nou.base.vo.xuao.SpecInfoListVo;
import cn.com.nou.base.vo.xuao.SpecInfoVo;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@Api(tags = "专业管理")
@RestController
@RequestMapping("/SpecInfo")
public class SpecInfoController {

    @Autowired
    SpecInfoService specInfoService;

    /**
     * 添加专业信息
     * @param specInfo
     * @return
     */
    @ApiOperation(value = "添加专业")
    @PostMapping
    public R addSpecInfo(@RequestBody SpecInfoVo specInfo){
        return specInfoService.addSpecInfo(specInfo);
    }

    /**
     * 多条件组合分页查询课程信息
     * @param specInfoListVo
     * @return
     */
    @ApiOperation(value = "多条件组合分页查询课程信息")
    @GetMapping
    public R getAllSpecInfo( SpecInfoListVo specInfoListVo){
        return specInfoService.getAllSpecInfo(specInfoListVo);
    }

    /**
     * 修改专业信息
     * @param specInfoVo
     * @return
     */
    @ApiOperation(value = "修改专业信息")
    @PutMapping
    public R updateSpecInfo(@RequestBody SpecInfoVo specInfoVo){
        return specInfoService.updateSpecInfo(specInfoVo);
    }

    /**
     * 根据专业ID删除专业
     * @param specId
     * @return
     */
    @ApiOperation(value = "删除专业信息")
    @DeleteMapping("/{specId}")
    public R deleteSpecInfo(@PathVariable String specId){
        return specInfoService.deleteSpecInfo(specId);
    }
}
